from APP.database import db

class alert_list(db.Model):
    __tablename__ = 'alert_list'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    type_id = db.Column(db.Integer,nullable=False)
    measurement = db.Column(db.String(50),nullable=False)
    status = db.Column(db.Integer,nullable=False)
    title = db.Column(db.String(50),nullable=False)
    content = db.Column(db.String(500),nullable=False)
    field = db.Column(db.String(50),nullable=False)
    time = db.Column(db.DateTime(),nullable=False)
    value = db.Column(db.Float)
    is_alert = db.Column(db.Integer,nullable=False)
    severity = db.Column(db.String(50),nullable=False)
    danger_data = db.Column(db.Text,nullable=False)
    work_note = db.Column(db.Text)

    def __init__(self,type_id,status,measurement,title,content,field,time,value,is_alert=None,severity=None,danger_data=None,work_note=None):
        self.type_id = type_id
        self.status = status
        self.measurement = measurement
        self.title = title
        self.content = content
        self.field = field
        self.time = time
        self.value = value
        self.is_alert = is_alert
        self.severity = severity
        self.danger_data = danger_data
        self.work_note = work_note
